package com.zhentao.enums.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhentao.enums.home.Carouselimage;
import lombok.Data;

import java.util.Date;

/**
 * @author : mgh
 * @date : 2024-09-02 15:34
 * @effect : 当前类的作用是
 * @projectTeam :
 */
@Data
public class CarouselimageDto extends Carouselimage {
    private int pageNum;
    private int pageSize;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date start;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date end;
    public int getFromIndex(){
        if(this.pageNum<1){return 1;}
        if(this.pageSize<1) {this.pageSize = 10;}
        return this.pageSize * (pageNum-1);
    }
}
